package com.huangwei.drivebook.Server;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;

public class StartServer {
    public static void main(String[] args) {
        int port = 80;
        Server server = new Server(port);
        WebAppContext webAppContext = new WebAppContext("WebContent", "/");

        webAppContext.setDescriptor("/WEB-INF/web.xml");
        webAppContext.setResourceBase("WebContent");
        webAppContext.setDisplayName("web");
        webAppContext.setClassLoader(Thread.currentThread()
                .getContextClassLoader());
        webAppContext.setConfigurationDiscovered(true);
        webAppContext.setParentLoaderPriority(true);

        server.setHandler(webAppContext);
        try {
            server.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("网络服务启动成功在 "+port+" ......");
    }
}
